ref
https://guebin.github.io/DV2022/posts/2022-10-24-8wk-12.html#fifa23-데이터분석
imports
FIFA23 데이터분석
FIFA23 data
- FIFA23라는 축구게임이 있음
- 게임에 실제 선수들이 나오면서 선수들의 능력치가 세밀하게 구현되어 있음
- 선수들 능력치에 대한 데이터셋은 캐글에 공개되어 있음 - https://www.kaggle.com/datasets/bryanb/fifa-player-stats-database?select=FIFA23_official_data.csv
데이터살펴보기
- 일단 살펴보기
df=pd.read_csv('https://raw.githubusercontent.com/guebin/DV2022/master/posts/FIFA23_official_data.csv')
df.head()| ID | Name | Age | Photo | Nationality | Flag | Overall | Potential | Club | Club Logo | ... | Real Face | Position | Joined | Loaned From | Contract Valid Until | Height | Weight | Release Clause | Kit Number | Best Overall Rating | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | 209658 | L. Goretzka | 27 | https://cdn.sofifa.net/players/209/658/23_60.png | Germany | https://cdn.sofifa.net/flags/de.png | 87 | 88 | FC Bayern München | https://cdn.sofifa.net/teams/21/30.png | ... | Yes | <span class="pos pos28">SUB | Jul 1, 2018 | NaN | 2026 | 189cm | 82kg | €157M | 8.0 | NaN |
| 1 | 212198 | Bruno Fernandes | 27 | https://cdn.sofifa.net/players/212/198/23_60.png | Portugal | https://cdn.sofifa.net/flags/pt.png | 86 | 87 | Manchester United | https://cdn.sofifa.net/teams/11/30.png | ... | Yes | <span class="pos pos15">LCM | Jan 30, 2020 | NaN | 2026 | 179cm | 69kg | €155M | 8.0 | NaN |
| 2 | 224334 | M. Acuña | 30 | https://cdn.sofifa.net/players/224/334/23_60.png | Argentina | https://cdn.sofifa.net/flags/ar.png | 85 | 85 | Sevilla FC | https://cdn.sofifa.net/teams/481/30.png | ... | No | <span class="pos pos7">LB | Sep 14, 2020 | NaN | 2024 | 172cm | 69kg | €97.7M | 19.0 | NaN |
| 3 | 192985 | K. De Bruyne | 31 | https://cdn.sofifa.net/players/192/985/23_60.png | Belgium | https://cdn.sofifa.net/flags/be.png | 91 | 91 | Manchester City | https://cdn.sofifa.net/teams/10/30.png | ... | Yes | <span class="pos pos13">RCM | Aug 30, 2015 | NaN | 2025 | 181cm | 70kg | €198.9M | 17.0 | NaN |
| 4 | 224232 | N. Barella | 25 | https://cdn.sofifa.net/players/224/232/23_60.png | Italy | https://cdn.sofifa.net/flags/it.png | 86 | 89 | Inter | https://cdn.sofifa.net/teams/44/30.png | ... | Yes | <span class="pos pos13">RCM | Sep 1, 2020 | NaN | 2026 | 172cm | 68kg | €154.4M | 23.0 | NaN |
5 rows × 29 columns
트랜스포즈하여 보는 것이 편할때도 있음
| 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | ... | 17650 | 17651 | 17652 | 17653 | 17654 | 17655 | 17656 | 17657 | 17658 | 17659 | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| ID | 209658 | 212198 | 224334 | 192985 | 224232 | 212622 | 197445 | 187961 | 208333 | 210514 | ... | 256879 | 269546 | 267647 | 253186 | 267461 | 269526 | 267946 | 270567 | 256624 | 256376 |
| Name | L. Goretzka | Bruno Fernandes | M. Acuña | K. De Bruyne | N. Barella | J. Kimmich | D. Alaba | 22 Paulinho | E. Can | João Cancelo | ... | 22 G. Leijon | Wu Fei | 22 E. Grosz | 22 S. Booth | 22 L. Grimpe | Deng Xiongtao | 22 Lim Jun Sub | A. Demir | 21 S. Czajor | 21 F. Jakobsson |
| Age | 27 | 27 | 30 | 31 | 25 | 27 | 30 | 32 | 28 | 28 | ... | 19 | 32 | 18 | 20 | 17 | 19 | 17 | 25 | 18 | 20 |
| Photo | https://cdn.sofifa.net/players/209/658/23_60.png | https://cdn.sofifa.net/players/212/198/23_60.png | https://cdn.sofifa.net/players/224/334/23_60.png | https://cdn.sofifa.net/players/192/985/23_60.png | https://cdn.sofifa.net/players/224/232/23_60.png | https://cdn.sofifa.net/players/212/622/23_60.png | https://cdn.sofifa.net/players/197/445/23_60.png | https://cdn.sofifa.net/players/187/961/22_60.png | https://cdn.sofifa.net/players/208/333/23_60.png | https://cdn.sofifa.net/players/210/514/23_60.png | ... | https://cdn.sofifa.net/players/256/879/22_60.png | https://cdn.sofifa.net/players/269/546/23_60.png | https://cdn.sofifa.net/players/267/647/22_60.png | https://cdn.sofifa.net/players/253/186/22_60.png | https://cdn.sofifa.net/players/267/461/22_60.png | https://cdn.sofifa.net/players/269/526/23_60.png | https://cdn.sofifa.net/players/267/946/22_60.png | https://cdn.sofifa.net/players/270/567/23_60.png | https://cdn.sofifa.net/players/256/624/21_60.png | https://cdn.sofifa.net/players/256/376/21_60.png |
| Nationality | Germany | Portugal | Argentina | Belgium | Italy | Germany | Austria | Brazil | Germany | Portugal | ... | Sweden | China PR | Romania | England | Germany | China PR | Korea Republic | Turkey | Poland | Sweden |
| Flag | https://cdn.sofifa.net/flags/de.png | https://cdn.sofifa.net/flags/pt.png | https://cdn.sofifa.net/flags/ar.png | https://cdn.sofifa.net/flags/be.png | https://cdn.sofifa.net/flags/it.png | https://cdn.sofifa.net/flags/de.png | https://cdn.sofifa.net/flags/at.png | https://cdn.sofifa.net/flags/br.png | https://cdn.sofifa.net/flags/de.png | https://cdn.sofifa.net/flags/pt.png | ... | https://cdn.sofifa.net/flags/se.png | https://cdn.sofifa.net/flags/cn.png | https://cdn.sofifa.net/flags/ro.png | https://cdn.sofifa.net/flags/gb-eng.png | https://cdn.sofifa.net/flags/de.png | https://cdn.sofifa.net/flags/cn.png | https://cdn.sofifa.net/flags/kr.png | https://cdn.sofifa.net/flags/tr.png | https://cdn.sofifa.net/flags/pl.png | https://cdn.sofifa.net/flags/se.png |
| Overall | 87 | 86 | 85 | 91 | 86 | 89 | 86 | 83 | 82 | 88 | ... | 52 | 51 | 52 | 51 | 54 | 48 | 48 | 51 | 50 | 50 |
| Potential | 88 | 87 | 85 | 91 | 89 | 90 | 86 | 83 | 82 | 88 | ... | 62 | 51 | 70 | 60 | 68 | 61 | 64 | 56 | 65 | 61 |
| Club | FC Bayern München | Manchester United | Sevilla FC | Manchester City | Inter | FC Bayern München | Real Madrid CF | Al Ahli | Borussia Dortmund | Manchester City | ... | Örebro SK | Wuhan Three Towns | Gaz Metan Mediaş | Crewe Alexandra | RB Leipzig | Meizhou Hakka | Jeju United FC | Ümraniyespor | Fleetwood Town | IFK Norrköping |
| Club Logo | https://cdn.sofifa.net/teams/21/30.png | https://cdn.sofifa.net/teams/11/30.png | https://cdn.sofifa.net/teams/481/30.png | https://cdn.sofifa.net/teams/10/30.png | https://cdn.sofifa.net/teams/44/30.png | https://cdn.sofifa.net/teams/21/30.png | https://cdn.sofifa.net/teams/243/30.png | https://cdn.sofifa.net/teams/112387/30.png | https://cdn.sofifa.net/teams/22/30.png | https://cdn.sofifa.net/teams/10/30.png | ... | https://cdn.sofifa.net/teams/705/30.png | https://cdn.sofifa.net/teams/116361/30.png | https://cdn.sofifa.net/teams/112637/30.png | https://cdn.sofifa.net/teams/121/30.png | https://cdn.sofifa.net/teams/112172/30.png | https://cdn.sofifa.net/teams/114628/30.png | https://cdn.sofifa.net/teams/1478/30.png | https://cdn.sofifa.net/teams/113796/30.png | https://cdn.sofifa.net/teams/112260/30.png | https://cdn.sofifa.net/teams/702/30.png |
| Value | €91M | €78.5M | €46.5M | €107.5M | €89.5M | €105.5M | €55.5M | €28.5M | €30.5M | €82.5M | ... | €150K | €30K | €180K | €110K | €210K | €100K | €100K | €70K | €90K | €90K |
| Wage | €115K | €190K | €46K | €350K | €110K | €130K | €220K | €61K | €63K | €250K | ... | €500 | €2K | €500 | €850 | €500 | €500 | €500 | €2K | €500 | €500 |
| Special | 2312 | 2305 | 2303 | 2303 | 2296 | 2283 | 2277 | 2273 | 2271 | 2262 | ... | 779 | 777 | 775 | 768 | 767 | 762 | 761 | 759 | 758 | 749 |
| Preferred Foot | Right | Right | Left | Right | Right | Right | Left | Right | Right | Right | ... | Right | Right | Right | Right | Right | Right | Right | Right | Right | Left |
| International Reputation | 4.0 | 3.0 | 2.0 | 4.0 | 3.0 | 4.0 | 4.0 | 3.0 | 3.0 | 3.0 | ... | 1.0 | 1.0 | 1.0 | 1.0 | 1.0 | 1.0 | 1.0 | 1.0 | 1.0 | 1.0 |
| Weak Foot | 4.0 | 3.0 | 3.0 | 5.0 | 3.0 | 4.0 | 4.0 | 4.0 | 4.0 | 4.0 | ... | 3.0 | 2.0 | 2.0 | 2.0 | 3.0 | 3.0 | 2.0 | 2.0 | 2.0 | 2.0 |
| Skill Moves | 3.0 | 4.0 | 3.0 | 4.0 | 3.0 | 3.0 | 3.0 | 4.0 | 3.0 | 4.0 | ... | 1.0 | 1.0 | 1.0 | 1.0 | 1.0 | 1.0 | 1.0 | 1.0 | 1.0 | 1.0 |
| Work Rate | High/ Medium | High/ High | High/ High | High/ High | High/ High | High/ Medium | Medium/ Medium | High/ High | Medium/ High | High/ Medium | ... | Medium/ Medium | Medium/ Medium | Medium/ Medium | Medium/ Medium | Medium/ Medium | Medium/ Medium | Medium/ Medium | Medium/ Medium | Medium/ Medium | Medium/ Medium |
| Body Type | Unique | Unique | Stocky (170-185) | Unique | Normal (170-) | Normal (170-185) | Normal (170-185) | Normal (170-185) | Stocky (185+) | Unique | ... | Normal (185+) | Normal (185+) | Lean (185+) | Lean (185+) | Lean (185+) | Normal (185+) | Lean (185+) | Lean (185+) | Normal (185+) | Normal (185+) |
| Real Face | Yes | Yes | No | Yes | Yes | Yes | Yes | Yes | Yes | Yes | ... | No | No | No | No | No | No | No | No | No | No |
| Position | <span class="pos pos28">SUB | <span class="pos pos15">LCM | <span class="pos pos7">LB | <span class="pos pos13">RCM | <span class="pos pos13">RCM | <span class="pos pos9">RDM | <span class="pos pos6">LCB | <span class="pos pos15">LCM | <span class="pos pos28">SUB | <span class="pos pos7">LB | ... | <span class="pos pos28">SUB | <span class="pos pos28">SUB | <span class="pos pos28">SUB | <span class="pos pos29">RES | <span class="pos pos29">RES | <span class="pos pos29">RES | <span class="pos pos29">RES | <span class="pos pos29">RES | <span class="pos pos29">RES | <span class="pos pos29">RES |
| Joined | Jul 1, 2018 | Jan 30, 2020 | Sep 14, 2020 | Aug 30, 2015 | Sep 1, 2020 | Jul 1, 2015 | Jul 1, 2021 | Jul 22, 2021 | Feb 18, 2020 | Aug 7, 2019 | ... | Jun 14, 2020 | Feb 15, 2019 | Jul 1, 2020 | Jul 1, 2019 | Feb 7, 2022 | Apr 11, 2022 | Jan 1, 2022 | Jun 6, 2021 | Jan 1, 2020 | Jan 8, 2020 |
| Loaned From | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | ... | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN |
| Contract Valid Until | 2026 | 2026 | 2024 | 2025 | 2026 | 2025 | 2026 | 2024 | 2024 | 2027 | ... | 2022 | 2022 | 2022 | 2022 | 2023 | 2027 | 2026 | 2023 | 2021 | 2021 |
| Height | 189cm | 179cm | 172cm | 181cm | 172cm | 177cm | 180cm | 183cm | 186cm | 182cm | ... | 188cm | 186cm | 190cm | 195cm | 186cm | 190cm | 195cm | 190cm | 187cm | 186cm |
| Weight | 82kg | 69kg | 69kg | 70kg | 68kg | 75kg | 78kg | 80kg | 86kg | 74kg | ... | 81kg | 78kg | 70kg | 80kg | 78kg | 78kg | 84kg | 82kg | 79kg | 78kg |
| Release Clause | €157M | €155M | €97.7M | €198.9M | €154.4M | €182M | €113.8M | €48.5M | €51.9M | €152.6M | ... | €218K | €47K | €356K | €215K | €488K | €218K | €188K | €142K | €214K | €131K |
| Kit Number | 8.0 | 8.0 | 19.0 | 17.0 | 23.0 | 6.0 | 4.0 | 15.0 | 23.0 | 7.0 | ... | 33.0 | 1.0 | 99.0 | 27.0 | 43.0 | 35.0 | 21.0 | 12.0 | 40.0 | 30.0 |
| Best Overall Rating | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | ... | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN | NaN |
29 rows × 17660 columns
- column이름조사
Index(['ID', 'Name', 'Age', 'Photo', 'Nationality', 'Flag', 'Overall',
'Potential', 'Club', 'Club Logo', 'Value', 'Wage', 'Special',
'Preferred Foot', 'International Reputation', 'Weak Foot',
'Skill Moves', 'Work Rate', 'Body Type', 'Real Face', 'Position',
'Joined', 'Loaned From', 'Contract Valid Until', 'Height', 'Weight',
'Release Clause', 'Kit Number', 'Best Overall Rating'],
dtype='object')
- 이름에 space가 있어서 좀 거슬림
Quiz column이름에 space를 제거할 수 있을까?
- 각 column 별로 자료형조사
0 209658
1 212198
2 224334
3 192985
4 224232
...
17655 269526
17656 267946
17657 270567
17658 256624
17659 256376
Name: ID, Length: 17660, dtype: int64
Quiz 각 컬럼별로 자료형을 조사할 수 있을까?
- 결측치조사
0 FC Bayern München
1 Manchester United
2 Sevilla FC
3 Manchester City
4 Inter
...
17655 Meizhou Hakka
17656 Jeju United FC
17657 Ümraniyespor
17658 Fleetwood Town
17659 IFK Norrköping
Name: Club, Length: 17660, dtype: object
- 무소속인 선수도 있지 않나?
(예비학습)
예비학습 끝
Quiz 각 컬럼별로 결측시의 수를 조사할 수 있을까?
Quiz 각 col별로 자료형과 결측치의 수를 조사한 표를 얻을 수 있을까?
| colname | dtype | na | |
|---|---|---|---|
| 0 | ID | int64 | 0 |
| 1 | Name | object | 0 |
| 2 | Age | int64 | 0 |
| 3 | Photo | object | 0 |
| 4 | Nationality | object | 0 |
| 5 | Flag | object | 0 |
| 6 | Overall | int64 | 0 |
| 7 | Potential | int64 | 0 |
| 8 | Club | object | 211 |
| 9 | Club Logo | object | 0 |
| 10 | Value | object | 0 |
| 11 | Wage | object | 0 |
| 12 | Special | int64 | 0 |
| 13 | Preferred Foot | object | 0 |
| 14 | International Reputation | float64 | 0 |
| 15 | Weak Foot | float64 | 0 |
| 16 | Skill Moves | float64 | 0 |
| 17 | Work Rate | object | 0 |
| 18 | Body Type | object | 38 |
| 19 | Real Face | object | 38 |
| 20 | Position | object | 35 |
| 21 | Joined | object | 1098 |
| 22 | Loaned From | object | 16966 |
| 23 | Contract Valid Until | object | 361 |
| 24 | Height | object | 0 |
| 25 | Weight | object | 0 |
| 26 | Release Clause | object | 1151 |
| 27 | Kit Number | float64 | 35 |
| 28 | Best Overall Rating | object | 17639 |
Quiz 열의선택: 결측치가 10000개 이상인 열을 보고싶다면? (먼가 문제가 있는 열 같은데?)
| Loaned From | Best Overall Rating | |
|---|---|---|
| 0 | NaN | NaN |
| 1 | NaN | NaN |
| 2 | NaN | NaN |
| 3 | NaN | NaN |
| 4 | NaN | NaN |
| ... | ... | ... |
| 17655 | NaN | NaN |
| 17656 | NaN | NaN |
| 17657 | NaN | NaN |
| 17658 | NaN | NaN |
| 17659 | NaN | NaN |
17660 rows × 2 columns
- .info()
<class 'pandas.core.frame.DataFrame'>
RangeIndex: 17660 entries, 0 to 17659
Data columns (total 29 columns):
# Column Non-Null Count Dtype
--- ------ -------------- -----
0 ID 17660 non-null int64
1 Name 17660 non-null object
2 Age 17660 non-null int64
3 Photo 17660 non-null object
4 Nationality 17660 non-null object
5 Flag 17660 non-null object
6 Overall 17660 non-null int64
7 Potential 17660 non-null int64
8 Club 17449 non-null object
9 Club Logo 17660 non-null object
10 Value 17660 non-null object
11 Wage 17660 non-null object
12 Special 17660 non-null int64
13 Preferred Foot 17660 non-null object
14 International Reputation 17660 non-null float64
15 Weak Foot 17660 non-null float64
16 Skill Moves 17660 non-null float64
17 Work Rate 17660 non-null object
18 Body Type 17622 non-null object
19 Real Face 17622 non-null object
20 Position 17625 non-null object
21 Joined 16562 non-null object
22 Loaned From 694 non-null object
23 Contract Valid Until 17299 non-null object
24 Height 17660 non-null object
25 Weight 17660 non-null object
26 Release Clause 16509 non-null object
27 Kit Number 17625 non-null float64
28 Best Overall Rating 21 non-null object
dtypes: float64(4), int64(5), object(20)
memory usage: 3.9+ MB
데이터정리하기
- 칼럼이름변경
| ID | Name | Age | Photo | Nationality | Flag | Overall | Potential | Club | Club_Logo | ... | Real_Face | Position | Joined | Loaned_From | Contract_Valid_Until | Height | Weight | Release_Clause | Kit_Number | Best_Overall_Rating | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | 209658 | L. Goretzka | 27 | https://cdn.sofifa.net/players/209/658/23_60.png | Germany | https://cdn.sofifa.net/flags/de.png | 87 | 88 | FC Bayern München | https://cdn.sofifa.net/teams/21/30.png | ... | Yes | <span class="pos pos28">SUB | Jul 1, 2018 | NaN | 2026 | 189cm | 82kg | €157M | 8.0 | NaN |
| 1 | 212198 | Bruno Fernandes | 27 | https://cdn.sofifa.net/players/212/198/23_60.png | Portugal | https://cdn.sofifa.net/flags/pt.png | 86 | 87 | Manchester United | https://cdn.sofifa.net/teams/11/30.png | ... | Yes | <span class="pos pos15">LCM | Jan 30, 2020 | NaN | 2026 | 179cm | 69kg | €155M | 8.0 | NaN |
| 2 | 224334 | M. Acuña | 30 | https://cdn.sofifa.net/players/224/334/23_60.png | Argentina | https://cdn.sofifa.net/flags/ar.png | 85 | 85 | Sevilla FC | https://cdn.sofifa.net/teams/481/30.png | ... | No | <span class="pos pos7">LB | Sep 14, 2020 | NaN | 2024 | 172cm | 69kg | €97.7M | 19.0 | NaN |
| 3 | 192985 | K. De Bruyne | 31 | https://cdn.sofifa.net/players/192/985/23_60.png | Belgium | https://cdn.sofifa.net/flags/be.png | 91 | 91 | Manchester City | https://cdn.sofifa.net/teams/10/30.png | ... | Yes | <span class="pos pos13">RCM | Aug 30, 2015 | NaN | 2025 | 181cm | 70kg | €198.9M | 17.0 | NaN |
| 4 | 224232 | N. Barella | 25 | https://cdn.sofifa.net/players/224/232/23_60.png | Italy | https://cdn.sofifa.net/flags/it.png | 86 | 89 | Inter | https://cdn.sofifa.net/teams/44/30.png | ... | Yes | <span class="pos pos13">RCM | Sep 1, 2020 | NaN | 2026 | 172cm | 68kg | €154.4M | 23.0 | NaN |
| ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
| 17655 | 269526 | Deng Xiongtao | 19 | https://cdn.sofifa.net/players/269/526/23_60.png | China PR | https://cdn.sofifa.net/flags/cn.png | 48 | 61 | Meizhou Hakka | https://cdn.sofifa.net/teams/114628/30.png | ... | No | <span class="pos pos29">RES | Apr 11, 2022 | NaN | 2027 | 190cm | 78kg | €218K | 35.0 | NaN |
| 17656 | 267946 | 22 Lim Jun Sub | 17 | https://cdn.sofifa.net/players/267/946/22_60.png | Korea Republic | https://cdn.sofifa.net/flags/kr.png | 48 | 64 | Jeju United FC | https://cdn.sofifa.net/teams/1478/30.png | ... | No | <span class="pos pos29">RES | Jan 1, 2022 | NaN | 2026 | 195cm | 84kg | €188K | 21.0 | NaN |
| 17657 | 270567 | A. Demir | 25 | https://cdn.sofifa.net/players/270/567/23_60.png | Turkey | https://cdn.sofifa.net/flags/tr.png | 51 | 56 | Ümraniyespor | https://cdn.sofifa.net/teams/113796/30.png | ... | No | <span class="pos pos29">RES | Jun 6, 2021 | NaN | 2023 | 190cm | 82kg | €142K | 12.0 | NaN |
| 17658 | 256624 | 21 S. Czajor | 18 | https://cdn.sofifa.net/players/256/624/21_60.png | Poland | https://cdn.sofifa.net/flags/pl.png | 50 | 65 | Fleetwood Town | https://cdn.sofifa.net/teams/112260/30.png | ... | No | <span class="pos pos29">RES | Jan 1, 2020 | NaN | 2021 | 187cm | 79kg | €214K | 40.0 | NaN |
| 17659 | 256376 | 21 F. Jakobsson | 20 | https://cdn.sofifa.net/players/256/376/21_60.png | Sweden | https://cdn.sofifa.net/flags/se.png | 50 | 61 | IFK Norrköping | https://cdn.sofifa.net/teams/702/30.png | ... | No | <span class="pos pos29">RES | Jan 8, 2020 | NaN | 2021 | 186cm | 78kg | €131K | 30.0 | NaN |
17660 rows × 29 columns
- 결측치제거
| ID | Name | Age | Photo | Nationality | Flag | Overall | Potential | Club | Club Logo | ... | Work Rate | Body Type | Real Face | Position | Joined | Contract Valid Until | Height | Weight | Release Clause | Kit Number | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | 209658 | L. Goretzka | 27 | https://cdn.sofifa.net/players/209/658/23_60.png | Germany | https://cdn.sofifa.net/flags/de.png | 87 | 88 | FC Bayern München | https://cdn.sofifa.net/teams/21/30.png | ... | High/ Medium | Unique | Yes | <span class="pos pos28">SUB | Jul 1, 2018 | 2026 | 189cm | 82kg | €157M | 8.0 |
| 1 | 212198 | Bruno Fernandes | 27 | https://cdn.sofifa.net/players/212/198/23_60.png | Portugal | https://cdn.sofifa.net/flags/pt.png | 86 | 87 | Manchester United | https://cdn.sofifa.net/teams/11/30.png | ... | High/ High | Unique | Yes | <span class="pos pos15">LCM | Jan 30, 2020 | 2026 | 179cm | 69kg | €155M | 8.0 |
| 2 | 224334 | M. Acuña | 30 | https://cdn.sofifa.net/players/224/334/23_60.png | Argentina | https://cdn.sofifa.net/flags/ar.png | 85 | 85 | Sevilla FC | https://cdn.sofifa.net/teams/481/30.png | ... | High/ High | Stocky (170-185) | No | <span class="pos pos7">LB | Sep 14, 2020 | 2024 | 172cm | 69kg | €97.7M | 19.0 |
| 3 | 192985 | K. De Bruyne | 31 | https://cdn.sofifa.net/players/192/985/23_60.png | Belgium | https://cdn.sofifa.net/flags/be.png | 91 | 91 | Manchester City | https://cdn.sofifa.net/teams/10/30.png | ... | High/ High | Unique | Yes | <span class="pos pos13">RCM | Aug 30, 2015 | 2025 | 181cm | 70kg | €198.9M | 17.0 |
| 4 | 224232 | N. Barella | 25 | https://cdn.sofifa.net/players/224/232/23_60.png | Italy | https://cdn.sofifa.net/flags/it.png | 86 | 89 | Inter | https://cdn.sofifa.net/teams/44/30.png | ... | High/ High | Normal (170-) | Yes | <span class="pos pos13">RCM | Sep 1, 2020 | 2026 | 172cm | 68kg | €154.4M | 23.0 |
| ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
| 17655 | 269526 | Deng Xiongtao | 19 | https://cdn.sofifa.net/players/269/526/23_60.png | China PR | https://cdn.sofifa.net/flags/cn.png | 48 | 61 | Meizhou Hakka | https://cdn.sofifa.net/teams/114628/30.png | ... | Medium/ Medium | Normal (185+) | No | <span class="pos pos29">RES | Apr 11, 2022 | 2027 | 190cm | 78kg | €218K | 35.0 |
| 17656 | 267946 | 22 Lim Jun Sub | 17 | https://cdn.sofifa.net/players/267/946/22_60.png | Korea Republic | https://cdn.sofifa.net/flags/kr.png | 48 | 64 | Jeju United FC | https://cdn.sofifa.net/teams/1478/30.png | ... | Medium/ Medium | Lean (185+) | No | <span class="pos pos29">RES | Jan 1, 2022 | 2026 | 195cm | 84kg | €188K | 21.0 |
| 17657 | 270567 | A. Demir | 25 | https://cdn.sofifa.net/players/270/567/23_60.png | Turkey | https://cdn.sofifa.net/flags/tr.png | 51 | 56 | Ümraniyespor | https://cdn.sofifa.net/teams/113796/30.png | ... | Medium/ Medium | Lean (185+) | No | <span class="pos pos29">RES | Jun 6, 2021 | 2023 | 190cm | 82kg | €142K | 12.0 |
| 17658 | 256624 | 21 S. Czajor | 18 | https://cdn.sofifa.net/players/256/624/21_60.png | Poland | https://cdn.sofifa.net/flags/pl.png | 50 | 65 | Fleetwood Town | https://cdn.sofifa.net/teams/112260/30.png | ... | Medium/ Medium | Normal (185+) | No | <span class="pos pos29">RES | Jan 1, 2020 | 2021 | 187cm | 79kg | €214K | 40.0 |
| 17659 | 256376 | 21 F. Jakobsson | 20 | https://cdn.sofifa.net/players/256/376/21_60.png | Sweden | https://cdn.sofifa.net/flags/se.png | 50 | 61 | IFK Norrköping | https://cdn.sofifa.net/teams/702/30.png | ... | Medium/ Medium | Normal (185+) | No | <span class="pos pos29">RES | Jan 8, 2020 | 2021 | 186cm | 78kg | €131K | 30.0 |
16364 rows × 27 columns
- Height, Weight의 자료형을 float형으로 수정하기
df.assign(
Height= list(map(lambda x: float(x[:-2]), df.Height)),
Weight= list(map(lambda x: float(x[:-2]), df.Weight))
)| ID | Name | Age | Photo | Nationality | Flag | Overall | Potential | Club | Club Logo | ... | Real Face | Position | Joined | Loaned From | Contract Valid Until | Height | Weight | Release Clause | Kit Number | Best Overall Rating | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | 209658 | L. Goretzka | 27 | https://cdn.sofifa.net/players/209/658/23_60.png | Germany | https://cdn.sofifa.net/flags/de.png | 87 | 88 | FC Bayern München | https://cdn.sofifa.net/teams/21/30.png | ... | Yes | <span class="pos pos28">SUB | Jul 1, 2018 | NaN | 2026 | 189.0 | 82.0 | €157M | 8.0 | NaN |
| 1 | 212198 | Bruno Fernandes | 27 | https://cdn.sofifa.net/players/212/198/23_60.png | Portugal | https://cdn.sofifa.net/flags/pt.png | 86 | 87 | Manchester United | https://cdn.sofifa.net/teams/11/30.png | ... | Yes | <span class="pos pos15">LCM | Jan 30, 2020 | NaN | 2026 | 179.0 | 69.0 | €155M | 8.0 | NaN |
| 2 | 224334 | M. Acuña | 30 | https://cdn.sofifa.net/players/224/334/23_60.png | Argentina | https://cdn.sofifa.net/flags/ar.png | 85 | 85 | Sevilla FC | https://cdn.sofifa.net/teams/481/30.png | ... | No | <span class="pos pos7">LB | Sep 14, 2020 | NaN | 2024 | 172.0 | 69.0 | €97.7M | 19.0 | NaN |
| 3 | 192985 | K. De Bruyne | 31 | https://cdn.sofifa.net/players/192/985/23_60.png | Belgium | https://cdn.sofifa.net/flags/be.png | 91 | 91 | Manchester City | https://cdn.sofifa.net/teams/10/30.png | ... | Yes | <span class="pos pos13">RCM | Aug 30, 2015 | NaN | 2025 | 181.0 | 70.0 | €198.9M | 17.0 | NaN |
| 4 | 224232 | N. Barella | 25 | https://cdn.sofifa.net/players/224/232/23_60.png | Italy | https://cdn.sofifa.net/flags/it.png | 86 | 89 | Inter | https://cdn.sofifa.net/teams/44/30.png | ... | Yes | <span class="pos pos13">RCM | Sep 1, 2020 | NaN | 2026 | 172.0 | 68.0 | €154.4M | 23.0 | NaN |
| ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
| 17655 | 269526 | Deng Xiongtao | 19 | https://cdn.sofifa.net/players/269/526/23_60.png | China PR | https://cdn.sofifa.net/flags/cn.png | 48 | 61 | Meizhou Hakka | https://cdn.sofifa.net/teams/114628/30.png | ... | No | <span class="pos pos29">RES | Apr 11, 2022 | NaN | 2027 | 190.0 | 78.0 | €218K | 35.0 | NaN |
| 17656 | 267946 | 22 Lim Jun Sub | 17 | https://cdn.sofifa.net/players/267/946/22_60.png | Korea Republic | https://cdn.sofifa.net/flags/kr.png | 48 | 64 | Jeju United FC | https://cdn.sofifa.net/teams/1478/30.png | ... | No | <span class="pos pos29">RES | Jan 1, 2022 | NaN | 2026 | 195.0 | 84.0 | €188K | 21.0 | NaN |
| 17657 | 270567 | A. Demir | 25 | https://cdn.sofifa.net/players/270/567/23_60.png | Turkey | https://cdn.sofifa.net/flags/tr.png | 51 | 56 | Ümraniyespor | https://cdn.sofifa.net/teams/113796/30.png | ... | No | <span class="pos pos29">RES | Jun 6, 2021 | NaN | 2023 | 190.0 | 82.0 | €142K | 12.0 | NaN |
| 17658 | 256624 | 21 S. Czajor | 18 | https://cdn.sofifa.net/players/256/624/21_60.png | Poland | https://cdn.sofifa.net/flags/pl.png | 50 | 65 | Fleetwood Town | https://cdn.sofifa.net/teams/112260/30.png | ... | No | <span class="pos pos29">RES | Jan 1, 2020 | NaN | 2021 | 187.0 | 79.0 | €214K | 40.0 | NaN |
| 17659 | 256376 | 21 F. Jakobsson | 20 | https://cdn.sofifa.net/players/256/376/21_60.png | Sweden | https://cdn.sofifa.net/flags/se.png | 50 | 61 | IFK Norrköping | https://cdn.sofifa.net/teams/702/30.png | ... | No | <span class="pos pos29">RES | Jan 8, 2020 | NaN | 2021 | 186.0 | 78.0 | €131K | 30.0 | NaN |
17660 rows × 29 columns
- Release Clause의 자료형을 float으로 수정하기
0 €157M
1 €155M
2 €97.7M
3 €198.9M
4 €154.4M
...
17655 €218K
17656 €188K
17657 €142K
17658 €214K
17659 €131K
Name: Release Clause, Length: 17660, dtype: object
(시도1–실패)
(시도1이 실패한 이유)
(nan에 대한 예비학습)
18 NaN
34 NaN
38 NaN
49 NaN
50 NaN
...
17378 NaN
17386 NaN
17535 NaN
17590 NaN
17618 NaN
Name: Release Clause, Length: 1151, dtype: object
(시도2–성공)
df.rename(columns={'Release Clause':'ReleaseClause'})\
.assign(ReleaseClause = list(map(lambda x: _f(x) if pd.isna(x)==False else x , df['Release Clause'])))\
.rename(columns={'ReleaseClause':'Release Clause'})| ID | Name | Age | Photo | Nationality | Flag | Overall | Potential | Club | Club Logo | ... | Real Face | Position | Joined | Loaned From | Contract Valid Until | Height | Weight | Release Clause | Kit Number | Best Overall Rating | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | 209658 | L. Goretzka | 27 | https://cdn.sofifa.net/players/209/658/23_60.png | Germany | https://cdn.sofifa.net/flags/de.png | 87 | 88 | FC Bayern München | https://cdn.sofifa.net/teams/21/30.png | ... | Yes | <span class="pos pos28">SUB | Jul 1, 2018 | NaN | 2026 | 189cm | 82kg | 157000000.0 | 8.0 | NaN |
| 1 | 212198 | Bruno Fernandes | 27 | https://cdn.sofifa.net/players/212/198/23_60.png | Portugal | https://cdn.sofifa.net/flags/pt.png | 86 | 87 | Manchester United | https://cdn.sofifa.net/teams/11/30.png | ... | Yes | <span class="pos pos15">LCM | Jan 30, 2020 | NaN | 2026 | 179cm | 69kg | 155000000.0 | 8.0 | NaN |
| 2 | 224334 | M. Acuña | 30 | https://cdn.sofifa.net/players/224/334/23_60.png | Argentina | https://cdn.sofifa.net/flags/ar.png | 85 | 85 | Sevilla FC | https://cdn.sofifa.net/teams/481/30.png | ... | No | <span class="pos pos7">LB | Sep 14, 2020 | NaN | 2024 | 172cm | 69kg | 97700000.0 | 19.0 | NaN |
| 3 | 192985 | K. De Bruyne | 31 | https://cdn.sofifa.net/players/192/985/23_60.png | Belgium | https://cdn.sofifa.net/flags/be.png | 91 | 91 | Manchester City | https://cdn.sofifa.net/teams/10/30.png | ... | Yes | <span class="pos pos13">RCM | Aug 30, 2015 | NaN | 2025 | 181cm | 70kg | 198900000.0 | 17.0 | NaN |
| 4 | 224232 | N. Barella | 25 | https://cdn.sofifa.net/players/224/232/23_60.png | Italy | https://cdn.sofifa.net/flags/it.png | 86 | 89 | Inter | https://cdn.sofifa.net/teams/44/30.png | ... | Yes | <span class="pos pos13">RCM | Sep 1, 2020 | NaN | 2026 | 172cm | 68kg | 154400000.0 | 23.0 | NaN |
| ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
| 17655 | 269526 | Deng Xiongtao | 19 | https://cdn.sofifa.net/players/269/526/23_60.png | China PR | https://cdn.sofifa.net/flags/cn.png | 48 | 61 | Meizhou Hakka | https://cdn.sofifa.net/teams/114628/30.png | ... | No | <span class="pos pos29">RES | Apr 11, 2022 | NaN | 2027 | 190cm | 78kg | 218000.0 | 35.0 | NaN |
| 17656 | 267946 | 22 Lim Jun Sub | 17 | https://cdn.sofifa.net/players/267/946/22_60.png | Korea Republic | https://cdn.sofifa.net/flags/kr.png | 48 | 64 | Jeju United FC | https://cdn.sofifa.net/teams/1478/30.png | ... | No | <span class="pos pos29">RES | Jan 1, 2022 | NaN | 2026 | 195cm | 84kg | 188000.0 | 21.0 | NaN |
| 17657 | 270567 | A. Demir | 25 | https://cdn.sofifa.net/players/270/567/23_60.png | Turkey | https://cdn.sofifa.net/flags/tr.png | 51 | 56 | Ümraniyespor | https://cdn.sofifa.net/teams/113796/30.png | ... | No | <span class="pos pos29">RES | Jun 6, 2021 | NaN | 2023 | 190cm | 82kg | 142000.0 | 12.0 | NaN |
| 17658 | 256624 | 21 S. Czajor | 18 | https://cdn.sofifa.net/players/256/624/21_60.png | Poland | https://cdn.sofifa.net/flags/pl.png | 50 | 65 | Fleetwood Town | https://cdn.sofifa.net/teams/112260/30.png | ... | No | <span class="pos pos29">RES | Jan 1, 2020 | NaN | 2021 | 187cm | 79kg | 214000.0 | 40.0 | NaN |
| 17659 | 256376 | 21 F. Jakobsson | 20 | https://cdn.sofifa.net/players/256/376/21_60.png | Sweden | https://cdn.sofifa.net/flags/se.png | 50 | 61 | IFK Norrköping | https://cdn.sofifa.net/teams/702/30.png | ... | No | <span class="pos pos29">RES | Jan 8, 2020 | NaN | 2021 | 186cm | 78kg | 131000.0 | 30.0 | NaN |
17660 rows × 29 columns
(시도3–성공) 그냥 결측치를 제거하고 변형해도 무방..
df2 = df.drop(columns=['Loaned From', 'Best Overall Rating']).dropna()
df2['Release Clause'] = list(map(lambda x: _f(x) if pd.isna(x)==False else x , df2['Release Clause']))
df2| ID | Name | Age | Photo | Nationality | Flag | Overall | Potential | Club | Club Logo | ... | Work Rate | Body Type | Real Face | Position | Joined | Contract Valid Until | Height | Weight | Release Clause | Kit Number | |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 0 | 209658 | L. Goretzka | 27 | https://cdn.sofifa.net/players/209/658/23_60.png | Germany | https://cdn.sofifa.net/flags/de.png | 87 | 88 | FC Bayern München | https://cdn.sofifa.net/teams/21/30.png | ... | High/ Medium | Unique | Yes | <span class="pos pos28">SUB | Jul 1, 2018 | 2026 | 189cm | 82kg | 157000000.0 | 8.0 |
| 1 | 212198 | Bruno Fernandes | 27 | https://cdn.sofifa.net/players/212/198/23_60.png | Portugal | https://cdn.sofifa.net/flags/pt.png | 86 | 87 | Manchester United | https://cdn.sofifa.net/teams/11/30.png | ... | High/ High | Unique | Yes | <span class="pos pos15">LCM | Jan 30, 2020 | 2026 | 179cm | 69kg | 155000000.0 | 8.0 |
| 2 | 224334 | M. Acuña | 30 | https://cdn.sofifa.net/players/224/334/23_60.png | Argentina | https://cdn.sofifa.net/flags/ar.png | 85 | 85 | Sevilla FC | https://cdn.sofifa.net/teams/481/30.png | ... | High/ High | Stocky (170-185) | No | <span class="pos pos7">LB | Sep 14, 2020 | 2024 | 172cm | 69kg | 97700000.0 | 19.0 |
| 3 | 192985 | K. De Bruyne | 31 | https://cdn.sofifa.net/players/192/985/23_60.png | Belgium | https://cdn.sofifa.net/flags/be.png | 91 | 91 | Manchester City | https://cdn.sofifa.net/teams/10/30.png | ... | High/ High | Unique | Yes | <span class="pos pos13">RCM | Aug 30, 2015 | 2025 | 181cm | 70kg | 198900000.0 | 17.0 |
| 4 | 224232 | N. Barella | 25 | https://cdn.sofifa.net/players/224/232/23_60.png | Italy | https://cdn.sofifa.net/flags/it.png | 86 | 89 | Inter | https://cdn.sofifa.net/teams/44/30.png | ... | High/ High | Normal (170-) | Yes | <span class="pos pos13">RCM | Sep 1, 2020 | 2026 | 172cm | 68kg | 154400000.0 | 23.0 |
| ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... | ... |
| 17655 | 269526 | Deng Xiongtao | 19 | https://cdn.sofifa.net/players/269/526/23_60.png | China PR | https://cdn.sofifa.net/flags/cn.png | 48 | 61 | Meizhou Hakka | https://cdn.sofifa.net/teams/114628/30.png | ... | Medium/ Medium | Normal (185+) | No | <span class="pos pos29">RES | Apr 11, 2022 | 2027 | 190cm | 78kg | 218000.0 | 35.0 |
| 17656 | 267946 | 22 Lim Jun Sub | 17 | https://cdn.sofifa.net/players/267/946/22_60.png | Korea Republic | https://cdn.sofifa.net/flags/kr.png | 48 | 64 | Jeju United FC | https://cdn.sofifa.net/teams/1478/30.png | ... | Medium/ Medium | Lean (185+) | No | <span class="pos pos29">RES | Jan 1, 2022 | 2026 | 195cm | 84kg | 188000.0 | 21.0 |
| 17657 | 270567 | A. Demir | 25 | https://cdn.sofifa.net/players/270/567/23_60.png | Turkey | https://cdn.sofifa.net/flags/tr.png | 51 | 56 | Ümraniyespor | https://cdn.sofifa.net/teams/113796/30.png | ... | Medium/ Medium | Lean (185+) | No | <span class="pos pos29">RES | Jun 6, 2021 | 2023 | 190cm | 82kg | 142000.0 | 12.0 |
| 17658 | 256624 | 21 S. Czajor | 18 | https://cdn.sofifa.net/players/256/624/21_60.png | Poland | https://cdn.sofifa.net/flags/pl.png | 50 | 65 | Fleetwood Town | https://cdn.sofifa.net/teams/112260/30.png | ... | Medium/ Medium | Normal (185+) | No | <span class="pos pos29">RES | Jan 1, 2020 | 2021 | 187cm | 79kg | 214000.0 | 40.0 |
| 17659 | 256376 | 21 F. Jakobsson | 20 | https://cdn.sofifa.net/players/256/376/21_60.png | Sweden | https://cdn.sofifa.net/flags/se.png | 50 | 61 | IFK Norrköping | https://cdn.sofifa.net/teams/702/30.png | ... | Medium/ Medium | Normal (185+) | No | <span class="pos pos29">RES | Jan 8, 2020 | 2021 | 186cm | 78kg | 131000.0 | 30.0 |
16364 rows × 27 columns
분석의 편의를 위하여 (1) colnames를 변경하고 (2) 결측치를 제거하고 (3) 몇 가지 전 처리를 추가로 진행한 뒤 df2를 만들어서 분석하는게 좋음